package utility;


public class SplitOnNumeric 
{
	SplitOnNumeric()
	{
		
	}
	
	static public String [] splitOnNumber(String str)
	{
		final char space = ' ';
		StringBuffer sb = new StringBuffer(str);
		for(int j=0;j<sb.length();j++)
		{  
			//System.out.println("sb length "+s.length()+" "+j);
			if(Character.isDigit(sb.charAt(j)))
			{
				if(j>0 && sb.charAt(j-1)!= space && Character.isDigit(sb.charAt(j-1))== false )
				{
						sb = new StringBuffer(sb.subSequence(0, j) + " " + sb.subSequence(j, sb.length()));
						//System.out.println(sb);
				}
			}
			else if(j>0 && sb.charAt(j-1)!= space && Character.isDigit(sb.charAt(j-1))== true)
			{
				sb = new StringBuffer(sb.subSequence(0, j) + " " + sb.subSequence(j, sb.length()));
				//System.out.println(sb);
			}

		}
		System.out.println(sb);
	return sb.toString().split(" ");
	}
		
	public static void main(String a [])
	{
		System.out.println("Output is : "+SplitOnNumeric.splitOnNumber("jdhf 11"));
	}
}
